package com.google.android.gms.internal;

import java.io.IOException;

public final class zzfme extends zzflm<zzfme> {
    private static volatile zzfme[] zzpxh;
    public String url = null;
    public Integer zzjsx = null;
    public zzflz zzpxi = null;
    private zzfmb zzpxj = null;
    private Integer zzpxk = null;
    private int[] zzpxl = zzflv.zzpvy;
    private String zzpxm = null;
    public Integer zzpxn = null;
    public String[] zzpxo = zzflv.EMPTY_STRING_ARRAY;

    public zzfme() {
        this.zzpvl = null;
        this.zzpnr = -1;
    }

    /* access modifiers changed from: private */
    /* renamed from: zzbm */
    public final zzfme zza(zzflj zzflj) throws IOException {
        zzfls zzfls;
        while (true) {
            int zzcxx = zzflj.zzcxx();
            switch (zzcxx) {
                case 0:
                    return this;
                case 8:
                    this.zzjsx = Integer.valueOf(zzflj.zzcya());
                    continue;
                case 18:
                    this.url = zzflj.readString();
                    continue;
                case 26:
                    if (this.zzpxi == null) {
                        this.zzpxi = new zzflz();
                    }
                    zzfls = this.zzpxi;
                    break;
                case 34:
                    if (this.zzpxj == null) {
                        this.zzpxj = new zzfmb();
                    }
                    zzfls = this.zzpxj;
                    break;
                case 40:
                    this.zzpxk = Integer.valueOf(zzflj.zzcya());
                    continue;
                case 48:
                    int zzb = zzflv.zzb(zzflj, 48);
                    int length = this.zzpxl == null ? 0 : this.zzpxl.length;
                    int[] iArr = new int[(zzb + length)];
                    if (length != 0) {
                        System.arraycopy(this.zzpxl, 0, iArr, 0, length);
                    }
                    while (length < iArr.length - 1) {
                        iArr[length] = zzflj.zzcya();
                        zzflj.zzcxx();
                        length++;
                    }
                    iArr[length] = zzflj.zzcya();
                    this.zzpxl = iArr;
                    continue;
                case 50:
                    int zzli = zzflj.zzli(zzflj.zzcym());
                    int position = zzflj.getPosition();
                    int i = 0;
                    while (zzflj.zzcyo() > 0) {
                        zzflj.zzcya();
                        i++;
                    }
                    zzflj.zzmw(position);
                    int length2 = this.zzpxl == null ? 0 : this.zzpxl.length;
                    int[] iArr2 = new int[(i + length2)];
                    if (length2 != 0) {
                        System.arraycopy(this.zzpxl, 0, iArr2, 0, length2);
                    }
                    while (length2 < iArr2.length) {
                        iArr2[length2] = zzflj.zzcya();
                        length2++;
                    }
                    this.zzpxl = iArr2;
                    zzflj.zzlj(zzli);
                    continue;
                case 58:
                    this.zzpxm = zzflj.readString();
                    continue;
                case 64:
                    try {
                        int zzcya = zzflj.zzcya();
                        switch (zzcya) {
                            case 0:
                            case 1:
                            case 2:
                            case 3:
                                this.zzpxn = Integer.valueOf(zzcya);
                                continue;
                            default:
                                StringBuilder sb = new StringBuilder(46);
                                sb.append(zzcya);
                                sb.append(" is not a valid enum AdResourceType");
                                throw new IllegalArgumentException(sb.toString());
                        }
                    } catch (IllegalArgumentException unused) {
                        zzflj.zzmw(zzflj.getPosition());
                        zza(zzflj, zzcxx);
                        break;
                    }
                case 74:
                    int zzb2 = zzflv.zzb(zzflj, 74);
                    int length3 = this.zzpxo == null ? 0 : this.zzpxo.length;
                    String[] strArr = new String[(zzb2 + length3)];
                    if (length3 != 0) {
                        System.arraycopy(this.zzpxo, 0, strArr, 0, length3);
                    }
                    while (length3 < strArr.length - 1) {
                        strArr[length3] = zzflj.readString();
                        zzflj.zzcxx();
                        length3++;
                    }
                    strArr[length3] = zzflj.readString();
                    this.zzpxo = strArr;
                    continue;
                default:
                    if (!super.zza(zzflj, zzcxx)) {
                        return this;
                    }
                    continue;
            }
            zzflj.zza(zzfls);
        }
    }

    public static zzfme[] zzdct() {
        if (zzpxh == null) {
            synchronized (zzflq.zzpvt) {
                if (zzpxh == null) {
                    zzpxh = new zzfme[0];
                }
            }
        }
        return zzpxh;
    }

    public final void zza(zzflk zzflk) throws IOException {
        zzflk.zzad(1, this.zzjsx.intValue());
        if (this.url != null) {
            zzflk.zzp(2, this.url);
        }
        if (this.zzpxi != null) {
            zzflk.zza(3, (zzfls) this.zzpxi);
        }
        if (this.zzpxj != null) {
            zzflk.zza(4, (zzfls) this.zzpxj);
        }
        if (this.zzpxk != null) {
            zzflk.zzad(5, this.zzpxk.intValue());
        }
        if (this.zzpxl != null && this.zzpxl.length > 0) {
            for (int zzad : this.zzpxl) {
                zzflk.zzad(6, zzad);
            }
        }
        if (this.zzpxm != null) {
            zzflk.zzp(7, this.zzpxm);
        }
        if (this.zzpxn != null) {
            zzflk.zzad(8, this.zzpxn.intValue());
        }
        if (this.zzpxo != null && this.zzpxo.length > 0) {
            for (String str : this.zzpxo) {
                if (str != null) {
                    zzflk.zzp(9, str);
                }
            }
        }
        super.zza(zzflk);
    }

    /* access modifiers changed from: protected */
    public final int zzq() {
        int zzq = super.zzq() + zzflk.zzag(1, this.zzjsx.intValue());
        if (this.url != null) {
            zzq += zzflk.zzq(2, this.url);
        }
        if (this.zzpxi != null) {
            zzq += zzflk.zzb(3, (zzfls) this.zzpxi);
        }
        if (this.zzpxj != null) {
            zzq += zzflk.zzb(4, (zzfls) this.zzpxj);
        }
        if (this.zzpxk != null) {
            zzq += zzflk.zzag(5, this.zzpxk.intValue());
        }
        if (this.zzpxl != null && this.zzpxl.length > 0) {
            int i = 0;
            for (int zzlx : this.zzpxl) {
                i += zzflk.zzlx(zzlx);
            }
            zzq = zzq + i + (this.zzpxl.length * 1);
        }
        if (this.zzpxm != null) {
            zzq += zzflk.zzq(7, this.zzpxm);
        }
        if (this.zzpxn != null) {
            zzq += zzflk.zzag(8, this.zzpxn.intValue());
        }
        if (this.zzpxo == null || this.zzpxo.length <= 0) {
            return zzq;
        }
        int i2 = 0;
        int i3 = 0;
        for (String str : this.zzpxo) {
            if (str != null) {
                i3++;
                i2 += zzflk.zztx(str);
            }
        }
        return zzq + i2 + (1 * i3);
    }
}
